Game apparatuses in which a game operation can be performed by tilting a controller are conventionally known. For example, a controller including a three-axis acceleration sensor therein is known, and a tilt angle of the controller is calculated by means of the acceleration sensor. Further, there is also known a technology for associating, in a driving game for which the above controller is used, the tilt angle of the controller with a steering angle of a steering wheel of a car appearing in the game.
However, if a controller as described above which includes an acceleration sensor therein is vigorously moved, since not only the gravitational acceleration but also many other components are contained in an acceleration vector detected by the acceleration sensor, there is a possibility that error is included in a calculated tilt angle (attitude) of the controller. In other words, when the acceleration sensor is in a static state, the attitude can be accurately determined based on an acceleration, whereas when the acceleration sensor is in motion, the attitude is erroneously determined.
In view of the above, a method of detecting an attitude of the controller or the like by means of an angular velocity sensor is conceivable. However, in the case of attitude calculation based on an angular velocity, error accumulates over time.
Therefore, an object of the exemplary embodiments is to provide an input device and an input processing method that enable accurate detection of an attitude of the input device by utilizing the characteristics of an acceleration sensor and an angular velocity sensor.
The exemplary embodiments have the following features to attain the object mentioned above.
An input device according to the exemplary embodiments is an input device equipped with an angular velocity sensor and an acceleration sensor, and the input device includes a first attitude detection section, an attitude correction section, and a processing section. The first attitude detection section detects a first detected attitude of the input device, based on angular velocity data outputted from the angular velocity sensor. The attitude correction section corrects the first detected attitude, based on acceleration data outputted from the acceleration sensor. The processing section executes predetermined information processing, without using components, in a horizontal direction and a depth direction, of the first detected attitude corrected by the attitude correction section. Here, the depth direction means a direction of an axis which is perpendicular to both a vertical direction and the horizontal direction in a three-dimensional space.
According to the above configuration, when an operation of changing the attitude of the input device is performed in such a manner as to cause a change of the attitude along the gravity direction, it is possible to execute information processing in which the change of the attitude is accurately reflected.
In another configuration example, the attitude correction section may define an attitude of the input device in a static state as a second detected attitude, based on an acceleration indicated by the acceleration data, and may correct the first detected attitude in such a manner that the first detected attitude approximates to the second detected attitude. Here, the attitude of the input device in a static state can be referred to as an attitude of the input device when the gravity direction is assumed to be a vertically-downward direction.
According to the above configuration, a current attitude of the input device can be accurately determined.
In another configuration example, the attitude correction section may define, as the second detected attitude, an attitude of the input device when a direction of the acceleration indicated by the acceleration data is substantially a vertically-downward direction.
According to the above configuration, it is possible to perform correction utilizing the gravity direction which is an absolute reference, and thus possible to perform correction with high reliability with respect to a change of the attitude in the gravity direction.
In still another configuration example, the attitude correction section may perform correction to make the first detected attitude approximate to the second detected attitude in such a manner that the more approximate a magnitude of the acceleration is to a magnitude of the gravitational acceleration, the more approximate the first detected attitude is to the second detected attitude.
According to the above configuration, the more approximate the magnitude of the acceleration detected by the acceleration sensor is to the magnitude of the gravitational acceleration, the more strongly the second detected attitude is reflected in the corrected attitude. It can be assumed that the more approximate the magnitude of the acceleration is to the magnitude of the gravitational acceleration, the more accurately the gravitational acceleration is indicated and the second detected attitude is determined. Accordingly, when the second detected attitude is accurately determined, the first detected attitude is corrected so as to be approximate to the second detected attitude, whereas when the second detected attitude is not determined with high accuracy, the first detected attitude is hardly corrected. Therefore, the corrected attitude can be accurately calculated.
In still another configuration example, the processing section may execute the predetermined processing, in accordance with a component, along the vertical direction, of a predetermined one of attitude vectors along three axes which represent the corrected first detected attitude.
According to the above configuration, in the case, for example, where a planar operation, such as an operation of a steering wheel of a car, is performed by moving the input device, a change of the attitude caused by the operation can be accurately reflected in the information processing.
In still another configuration example, the input device may include a display screen in an integrated manner, and the processing section may display a result of the predetermined information processing on the display screen.
According to the above configuration, in a situation where a user can easily recognize an error of tilt, such as a case where the display screen also tilts as the input device is tilted, it is possible to perform screen display that does not make the user feel the sense of incongruity with respect to a tilt recognized by the user.
An input processing program according to the exemplary embodiments is an input processing program executed by a computer of an information processing apparatus equipped with an angular velocity sensor and an acceleration sensor, and the input processing program causes the computer to function as a first attitude detection section, an attitude correction section, and a processing section. The first attitude detection section detects a first detected attitude of the input device, based on angular velocity data outputted from the angular velocity sensor. The attitude correction section corrects the first detected attitude, based on acceleration data outputted from the acceleration sensor. The processing section executes predetermined information processing, without using components, in a horizontal direction and a depth direction, of the first detected attitude corrected by the attitude correction section.
An input processing method according to the exemplary embodiments is an input processing method used in an information processing apparatus equipped with an angular velocity sensor and an acceleration sensor, and the input processing method includes the steps of: detecting a first detected attitude of the input device, based on angular velocity data outputted from the angular velocity sensor; correcting the first detected attitude, based on acceleration data outputted from the acceleration sensor; and executing predetermined information processing, without using components, in a horizontal direction and a depth direction, of the corrected first detected attitude.
An input processing system according to the exemplary embodiments is an input processing system equipped with an angular velocity sensor and an acceleration sensor, and the input processing system includes a first attitude detection section, an attitude correction section, and a processing section. The first attitude detection section detects a first detected attitude of the input device, based on angular velocity data outputted from the angular velocity sensor. The attitude correction section corrects the first detected attitude, based on acceleration data outputted from the acceleration sensor. The processing section executes predetermined information processing, without using components, in a horizontal direction and a depth direction, of the first detected attitude corrected by the attitude correction section.
According to the exemplary embodiments, when an operation of changing the attitude of the input device is performed in such a manner as to cause a change of the attitude along the gravity direction, it is possible to execute information processing in which the change of the attitude is accurately reflected.